GtkFontChooser: Use a GtkStack
authorMatthias Clasen <mclasen@redhat.com>
Thu, 7 May 2015 22:28:39 +0000 (18:28 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 7 May 2015 22:28:39 +0000 (18:28 -0400)
gtk/gtkfontchooserwidget.c
gtk/ui/gtkfontchooserwidget.ui

index 57236878740005bfa5e0306bebe0e86b8576c46e..526823ce73fd99866c3a2c65e12f6e74ccf7bb3d 100644 (file)
@@ -37,7 +37,7 @@
 #include "gtkintl.h"
 #include "gtklabel.h"
 #include "gtkliststore.h"
-#include "gtknotebook.h"
+#include "gtkstack.h"
 #include "gtkprivate.h"
 #include "gtkscale.h"
 #include "gtkscrolledwindow.h"
@@ -79,7 +79,7 @@ struct _GtkFontChooserWidgetPrivate
   GtkTreeViewColumn *family_face_column;
   GtkCellRenderer *family_face_cell;
   GtkWidget    *list_scrolled_window;
-  GtkWidget    *list_notebook;
+  GtkWidget    *list_stack;
   GtkTreeModel *model;
   GtkTreeModel *filter_model;
 
@@ -512,7 +512,7 @@ row_inserted_cb (GtkTreeModel *model,
   GtkFontChooserWidget *fontchooser = user_data;
   GtkFontChooserWidgetPrivate *priv = fontchooser->priv;
 
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->list_notebook), 0);
+  gtk_stack_set_visible_child_name (GTK_STACK (priv->list_stack), "list");
 }
 
 static void
@@ -524,7 +524,7 @@ row_deleted_cb  (GtkTreeModel *model,
   GtkFontChooserWidgetPrivate *priv = fontchooser->priv;
 
   if (gtk_tree_model_iter_n_children (model, NULL) == 0)
-    gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->list_notebook), 1);
+    gtk_stack_set_visible_child_name (GTK_STACK (priv->list_stack), "empty");
 }
 
 static void
@@ -551,7 +551,7 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, family_face_column);
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, family_face_cell);
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, list_scrolled_window);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, list_notebook);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, list_stack);
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, model);
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, filter_model);
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, preview);
index 2d5ec444b41dec34029aea4e7cff15f2a4d1b823..77590c1ad536e67d4048ad9bb501e4875ecb0729 100644 (file)
           </packing>
         </child>
         <child>
-          <object class="GtkNotebook" id="list_notebook">
+          <object class="GtkStack" id="list_stack">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="show_tabs">False</property>
             <child>
               <object class="GtkScrolledWindow" id="list_scrolled_window">
                 <property name="width_request">400</property>
                   </object>
                 </child>
               </object>
-            </child>
-            <child type="tab">
+              <packing>
+                <property name="name">list</property>
+              </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="empty_list">
+              <object class="GtkLabel">
                 <property name="visible">True</property>
                 <property name="halign">center</property>
                 <property name="valign">start</property>
                 <property name="label" translatable="yes">No fonts matched your search. You can revise your search and try again.</property>
               </object>
               <packing>
-                <property name="position">1</property>
+                <property name="name">empty</property>
               </packing>
             </child>
-            <child type="tab">
-            </child>
           </object>
           <packing>
             <property name="left_attach">0</property>